﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;

using System.IO;

namespace AimGameEngine.NodeEditorObject
{
    partial class PropretyIrrKlangPlayer : Form
    {
        NodeIrrKlangPlayer nodeirrklangplayer;
        public PropretyIrrKlangPlayer(NodeIrrKlangPlayer nodeirrklangplayer)
        {
            InitializeComponent();

            this.nodeirrklangplayer = nodeirrklangplayer;
            this.PathAudios.Text = nodeirrklangplayer.MyData.Data;
            this.PlayLoop.Checked = this.nodeirrklangplayer.PlayLoop;
        }

        private void Browse_Click(object sender, EventArgs e)
        {
            OpenFileDialog file = new OpenFileDialog();
            // Default to the directory which contains our content files.
            string assemblyLocation = Assembly.GetExecutingAssembly().Location;
            string relativePath = Path.Combine(assemblyLocation, "../../../../Content");
            string contentPath = Path.GetFullPath(relativePath);

            file.InitialDirectory = contentPath;

            file.Title = "Browse Texture2D";
            // IrrKlang support
            //RIFF WAVE (*.wav) 
            //Ogg Vorbis (*.ogg) 
            //MPEG-1 Audio Layer 3 (*.mp3)
            //Free Lossless Audio Codec (*.flac) 
            //Amiga Modules (*.mod) 
            //Impulse Tracker (*.it) 
            //Scream Tracker 3 (*.s3d) 
            //Fast Tracker 2 (*.xm)

            file.Filter = "Audios Files (*.wav;*.ogg;*.mp3;*.flac;*.mod;*.it;*.s3d;*.xm)|*.wav;*.ogg;*.mp3;*.flac;*.mod;*.it;*.s3d;*.xm|" +
                          "RIFF WAVE (*.wav)|*.wav|" +
                          "Ogg Vorbis (*.ogg) |*.ogg|" +
                          "MPEG-1 Audio Layer 3 (*.mp3)|*.mp3|" +
                          "Free Lossless Audio Codec (*.flac)|*.flac|" +
                          "Amiga Modules (*.mod) |*.mod|" +
                          "Impulse Tracker (*.it)|*.it|" +
                          "Scream Tracker 3 (*.s3d)|*.s3d|" +
                          "Fast Tracker 2 (*.xm)|*.xm";
                          //"All Files (*.*)|*.*";

            file.FilterIndex = 1;

            if (file.ShowDialog() == DialogResult.OK)
            {
                this.PathAudios.Text = file.FileName;
            }
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            nodeirrklangplayer.MyData.Data = this.PathAudios.Text;
            nodeirrklangplayer.PlayLoop = this.PlayLoop.Checked;
        }

    }
}
